/**
 * Game
 * Manage game mecanics and managers
 **/
var Game = function() {
	// Game objects
	this.mMap = null;
	this.player = null;

	this.managers = new Array();

	// Game state 
	this.waiting = null;
	this.stop = null;
	this.cleared = null;

	this.init = function() {
		log('*** INIT GAME ***');
		// Map
		this.mMap = new MapManager();
		this.mMap.init();
		// Player
		this.player = new Player();
		this.player.init({x:0,y:0});

		// Add all managers to the managers container
		this.managers.push(this.mMap);
	}

	this.start = function() {
		log('*** START GAME ***');
		this.stop = false;
	}

	this.clear = function() {
	}

	this.update = function() {
		for (var i = 0; i < this.managers.length; i++)
			this.managers[i].update();

		this.player.update();

		this.render();
	}

	this.render = function() {
		for (var i = 0; i < this.managers.length; i++)
			this.managers[i].render();

		this.player.render();
	}
};
